]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dnd: Fix drag cancel animation scale
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 8 Aug 2019 20:21:12 +0000 (17:21 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Fri, 9 Aug 2019 13:58:46 +0000 (10:58 -0300)
When a drag is cancelled and the source actor
is visible, the drag actor is animated back to
the source position. The scale that the drag
actor will become is calculated as:

    scale = this._dragActor.width / sourceScaledWidth

However, this is wrong; what we wanted to do
is the opposite:

    scale = sourceScaledWidth / this._dragActor.width

Fix the scale calculation to match the math
above.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/671

js/ui/dnd.js

index 6539443cd8eda10b7cdad2e9f9314ea5a9345e4a..786d6541992420b112f99d805160eec4feb19561 100644 (file)
@@ -611,7 +611,7 @@ var _Draggable = class _Draggable {
             // Snap the clone back to its source
             [x, y] = this._dragActorSource.get_transformed_position();
             let [sourceScaledWidth] = this._dragActorSource.get_transformed_size();
-            scale = sourceScaledWidth ? this._dragActor.width / sourceScaledWidth : 0;
+            scale = sourceScaledWidth ? sourceScaledWidth / this._dragActor.width : 0;
         } else if (this._dragOrigParent) {
             // Snap the actor back to its original position within
             // its parent, adjusting for the fact that the parent